package DAO;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.Vector;

public class PetDao {
    public PetDao() {
    }
    //**********************************consultas********************************
    public static Vector <Vector<String> > Consultar_Pet() {
        Vector <Vector<String> > matriz= new Vector <Vector<String> >();
        Vector<String> fila=new  Vector<String>();
        Vector<String> id=new  Vector<String>();
        Conexion conexion = new Conexion();
        Connection conex;

        try {
        conex = conexion.getConnection();
        PreparedStatement ps = null;
        ResultSet rs = null;

        ResultSet rsa = null;
        String nombre =new String("");
        ps = conex.prepareStatement("select petnumber,petname\n" + 
        "from pet\n");
        rsa = ps.executeQuery();
                            
        if (rsa != null) {
          while (rsa.next()) {
           fila.add(rsa.getString("petname"));
                 id.add(rsa.getString("petnumber"));
             }
        }           
        conex.close();

        } catch (SQLException ex) {
        System.err.println("SQLException: " + ex.getMessage());

        }
        matriz.add(id);
        matriz.add(fila);
        return matriz;
    }

}